1) Field of the Invention
The present invention relates to a technique applied to a magnetic tape unit to write on a magnetic tape (storage medium) data compressed through, for example, an EDRC (Enhanced Data Recording Capability) system, and read the compressed data. More particularly, the invention relates to a method of controlling a magnetic tape unit, for performing ROR (Read Opposite Retry) processing required after read back of the compressed data.
2) Description of the Related Art
In recent years, more efficient backup/restore operations in which data is copied between a DASD (Direct Access Storage Device) and a magnetic tape have been desired for a requirement for a higher speed computer system. Therefore, an EDRC compression mechanism is used to compress data, and the compressed data is recorded on the magnetic tape, thereby recording massive amounts of data on the magnetic tape.
In general, when the data compressed through the EDRC system is read from the magnetic tape, it is possible to expand the compressed data read by the magnetic tape unit from the magnetic tape in a forward direction (a normal reading direction). However, it is impossible to expand the compressed data read in a backward direction in response to a read back command. Hence, when a host computer issues the read back command to read the compressed data in the backward direction, it is necessary to carry out ROR processing in which the compressed data is read in the forward direction once again.
FIG. 27 is a block diagram showing a hardware configuration of a typical magnetic tape controller. As shown in FIG. 27, a magnetic tape controller (MTC) 10 is installed between a CPU (host computer, host processor) 20 and a magnetic tape unit (MTU) 30. The MTC 10 controls the operation of the MTU 30 in response to a command from the CPU 20.
Further, the MTC 10 includes a channel interface circuit 11, a data compressing circuit 12, a data expanding circuit 13, a host interface controller (HIC) 14, a format controller (FMT) 15, a command buffer 16, and a data buffer 17.
Here, the channel interface circuit 11 controls a channel interface with the CPU 20, the data compressing circuit 12 performs data compression through, for example, the EDRC system, and the data expanding circuit 13 expands the compressed data.
Additionally, the HIC 14 makes a format conversion and a format control for transmission and reception of data between the CPU 20 and the MTC 10. The FMT 15 makes a format conversion and a format control for transmission and reception of data between the MTU 30 and the MTC 10.
The command buffer 16 establishes communication between the HIC 14 and the FMT 15. According to an instruction from the CPU 20, commands to instruct, for example, the operations which should be performed by the HIC 14 and the FMT 15 are stored in the command buffer 16. Data (write data) to be written on the magnetic tape (storage medium) or data (read data) read from the magnetic tape is temporarily stored in the data buffer 17 in blocks.
Further, as shown in FIG. 28, the command buffer 16 includes an HIC command pointer table (HQP) 16-1, an HIC command list table (HQL) 16-2, an FMT command pointer table (FQP) 16-3, and an FMT command list table (FQL) 16-4.
In the HQP 16-1, a prefetch instruction flag is set to cause the FMT 15 to previously perform a reading and a read back, a command pointer is set to indicate a position of the latest command in the HQL 16-2, and a block ID pointer is set to indicate an ID (IDentification) of the latest block in the data buffer 17.
The HQL 16-2 serves as a command queue in which commands to instruct the operation to be performed by the HIC 14 are stored in the order in which the commands are generated in response to the instruction from the CPU 20. The HQL 16-2 holds, for example, a pointer indicating a position on the data buffer 17, of a data block corresponding to each command.
In the FQP 16-3, a prefetch completion flag is set to show that the reading and the read back are previously performed, and the previous operations are completed, a command pointer is set to indicate a position of the latest command in the FQL 16-4, and a block ID pointer is set to indicate an ID of the latest block in the data buffer 17.
The FQL 16-4 serves as a command queue in which commands to instruct the operation to be performed by the FMT 15 are stored in the order in which the commands are generated in response to the instruction from the CPU 20. The FQL 16-4 holds, for example, a pointer indicating a position on the data buffer 17, of a data block corresponding to each command.
Next, a description will be given of the operation of the MTC 10 having the above configuration.
Write Sequence
First, referring to FIG. 28, a description will be given of a case where, under control of the MTC 10, the MTU 30 is operated in response to the instruction from the CPU 20 to record predetermined data (data blocks "DATA 1,""DATA 2," and "DATA 3") on the magnetic tape. Moreover, in FIG. 28, at a time of writing, the prefetch instruction flag is not set in the HQP 16-1, and the prefetch completion flag is not set in the FQP 16-3.
In the MTC 10, when a write command issued from the CPU 20 is received through the channel interface circuit 11, write commands (WRITE 1, WRITE 2, and WRITE 3) are sequentially stored in the HQL 16-2 according to the command pointer of the HQP 16-1. Further, for each of the write commands, the data blocks "DATA 1,""DATA 2," and "DATA 3" to be recorded on the magnetic tape are sequentially written in the data buffer 17. Moreover, when the data to be written on the magnetic tape is written on the magnetic tape under compression, the data is temporarily input into the data compressing circuit 12 through the channel interface circuit 11, and is written into the data buffer 17 after the compression by the data compressing circuit 12 through the EDRC system.
Further, the FMT 15 compares a value of the command pointer of the HQP 16-1 with a value of the command pointer of the FQP 16-3 to sequentially transfer the data blocks corresponding to differences therebetween to the MTU 30, resulting in recording the data blocks onto the magnetic tape. At the time, as shown in FIG. 28, the FQP 16-3 and the FQL 16-4 are sequentially updated. That is, every time the data block in the data buffer 17 is transferred to the MTU 30 to be recorded on the magnetic tape, a command which has been executed is recorded on the FQL 16-4, and an ID of the latest data block which has been written is recorded thereon according to the command pointer of the FQP 16-3.
Moreover, FIG. 28 shows a state in which the first data block "DATA 1" has been written on the magnetic tape. In the state shown in FIG. 28, the block ID pointer of the HQP 16-1 denotes an ID (for example, "3") of the third data block, and the block ID pointer of the FQP 16-3 denotes an ID (for example, "1") of the first data block.
Read Sequence
In the MTC 10, when a read command issued from the CPU 20 is received through the channel interface circuit 11, the HIC 14 sets the prefetch instruction flag in the HQP 16-1. Further, the FMT 15 sees the prefetch instruction flag set in the HQP 16-1 to cause the MTU 30 to read the plurality of data blocks from the magnetic tape, and write the data blocks into the data buffer 17.
At the time, as shown by the arrow in FIG. 29, the MTU 30 is mechanically operated such that a head of the MTU 30 is moved in a forward direction relative to the magnetic tape MT, thereby sequentially reading the data blocks "DATA 1,""DATA 2," and "DATA 3." Though the three data blocks are illustratively written into the data buffer 17, the number of data blocks to be prefetched can be set according to, for example, a capacity of the data buffer 17. A control may be made to stop the prefetch when an amount of written data exceeds the capacity of the data buffer 17.
Further, as shown in FIG. 30, the commands "READ 1," "READ 2," and "READ 3" corresponding to the data blocks written in the data buffer 17 are sequentially set in the command queue of the FQL 16-4 according to the command pointer of the FQP 16-3.
In such a manner, a predetermined number of (three in the discussion) data blocks are written into the data buffer 17, thereafter storing the latest command pointer and the latest block ID in the FQP 16-3, and setting the prefetch completion flag therein.
After the prefetch completion flag is set in the FQP 16-3, the HIC 14 compares a value of the command pointer of the HQP 16-1 with a value of the command pointer of the FQP 16-3 to sequentially transfer the data blocks corresponding to differences therebetween to the CPU 20. At the time, as shown in FIG. 31, the HQP 16-1 and the HQL 16-2 are sequentially updated. That is, every time the data block in the data buffer 17 is transferred to the CPU 20, a command which has been executed is recorded in the HQL 16-2, and an ID of the latest data block which has been transferred is recorded therein according to the command pointer of the HQP 16-1.
Moreover, FIG. 31 shows a state in which all the three data blocks have been transferred to (read into) the CPU 20. In the state shown in FIG. 31, both the block ID pointer of the HQP 16-1 and the block ID pointer of the FQP 16-3 denote the ID (for example, "3") of the third data block.
Further, at a time of data transfer to the CPU 20, the data read from the magnetic tape may be under compression. In such a case, the data is temporarily input into the data expanding circuit 13 to be expanded, and is thereafter transferred to the CPU 20.
After the prefetch as stated above, in response to the read commands continuously issued from the CPU 20, the MTC 10 can send the read data to a channel for transfer to the CPU 20 as long as any read data is present in the data buffer 17 without the mechanical operation (actual reading) of the MTU 30. Therefore, it is possible to eliminate the need for the mechanical operation of the MTU 30 for each data block, resulting in enhanced efficiency of data transfer at a time of reading.
Read Back Sequence
In the MTC 10, when the read back command issued from the CPU 20 is received through the channel interface circuit 11, the HIC 14 sets the prefetch instruction flag in the HQP 16-1. Further, the FMT 15 sees the prefetch instruction flag set in the HQP 16-1 to cause the MTU 30 to read one data block from the magnetic tape, and write the data block in the data buffer 17.
At the time, as shown by the arrow in FIG. 32, the MTU 30 is mechanically operated such that the head of the MTU 30 is moved by one data block in the reverse direction (backward direction) relative to the magnetic tape MT, thereby reading the one data block. Thus, as illustratively shown in FIG. 33, a data block "aabbcc . . . xxyyzz" written in the forward direction at the time of writing is written into the data buffer 17 as "zzyyxx . . . ccbbaa" by the read back.
Further, as shown in FIG. 33, a command "READBACK" corresponding to the data block written in the data buffer 17 is set in the command queue of the FQL 16-4 according to a command pointer of the FQP 16-3.
In such a manner, the one read back data block is written into the data buffer 17. Thereafter, the latest command pointer and the latest block ID are stored in the FQP 16-3, and the prefetch completion flag is set therein.
Meanwhile, even when the CPU 20 issues the read back command, the MTC 10 has to send forward data to a channel so as to transfer the data to the CPU 20. As stated above, it is generally impossible to expand the data compressed through the EDRC system with the data arranged in the backward direction.
Hence, in the prior art, the ROR processing is performed between the channel and the MTC 10.
That is, when the CPU 20 issues the read back command, and the prefetch completion flag is set in the FQP 16-3 as described above, the MTC 10 sends back to the CPU 20 as a UCK (Unit ChecK) a retry request for a read command shown by ERP (Error Recovery Procedure)=26. In response thereto, the CPU 20 issues the read command.
The MTC 10 receives the read command from the CPU 20 to carry out the above read sequence. That is, in the MTC 10, when the read command issued from the CPU 20 is received through the channel interface circuit 11, the HIC 14 sets the prefetch instruction flag in the HQP 16-1. Further, the FMT 15 sees the prefetch instruction flag set in the HQP 16-1 to cause the MTU 30 to read one data block from the magnetic tape, and write the data block into the data buffer 17.
At the time, as shown by the arrow in FIG. 34, the MTU 30 is mechanically operated such that the head of the MTU 30 is moved by one data block in a forward direction relative to the magnetic tape MT, thereby reading the previously read back data block in the forward direction. After the reading, the data is stored in the data buffer 17 with the contents arranged in the forward direction as shown in FIG. 35.
Further, as shown in FIG. 35, a command "READ" corresponding to the data block written into the data buffer 17 overwrites the previous command "READBACK" in the command queue of the FQL 16-4 according to the command pointer of the FQP 16-3. Thereafter, the latest command pointer and the latest block ID are stored in the FQP 16-3, and the prefetch completion flag is set therein.
After the prefetch completion flag is set in the FQP 16-3, the HIC 14 compares a value of the command pointer of the HQP 16-1 with a value of the command pointer of the FQP 16-3 to transfer one data block corresponding to a difference therebetween to the CPU 20. At the time, as shown in FIG. 36, the HQP 16-1 and the HQL 16-2 are updated to record the command "READ" which has been executed into the HQL 16-2. Moreover, in a state shown in FIG. 36, block ID pointers of the HQP 16-1 and the FQP 16-3 denote an ID (for example, "2") of the second data block.
Further, at the time of data transfer to the CPU 20, the compressed forward data read from the magnetic tape is temporarily input into the data expanding circuit 13. The data is expanded and is subsequently transferred to the CPU 20.
Thereafter, the CPU 20 issues a backspace command. The MTU 30 mechanically operates under control of the FMT 15 such that the head of the MTU 30 can be positioned at a position the front of the block (the left-hand side in FIG. 37) after the completion of a back read operation as shown by the arrow in FIG. 37.
When the CPU (host computer) 20 issues the read back command to the magnetic tape on which the EDRC compressed data is recorded, in the MTC 10, conventionally, the ROR processing described with reference to FIGS. 34 to 37 is performed to transfer a target data block to the CPU 20 after the expansion in the data expanding circuit 13.
FIG. 38 shows all relative movements (mechanical operations) of the head of the MTU 30 with respect to the magnetic tape MT for a period from the issue of the read back command to the completion of the ROR processing.
As shown in FIG. 38, a first mechanical operation (see the upper arrow in FIG. 38) is performed in a backward direction in response to the read back command (READ BACK). Subsequently, a second mechanical operation (see the middle arrow in FIG. 38) is performed in a forward direction in response to the read command (READ). Finally, a third mechanical operation (see the lower arrow in FIG. 38) is performed in a backward direction in response to the backspace command (BACK SPACE). That is, in order to read only the one data block, it is necessary to carry out the processing with the mechanical operations (the operations of the MTU 30) in response to all the back read, read, and backspace commands.
When a job is executed to continuously issue the read back commands, it is impossible to continuously transfer the plurality of data blocks unlike the reading and the writing. Consequently, the ROR processing must be performed for each data block, resulting in a considerably long processing time.
For example, in order to read back data blocks D, C, B, and A in this order as shown in FIG. 39, for each of the data blocks D, C, B, and A, the MTU 30 has to perform the mechanical operations corresponding to the back read command (RB), the read command (RD), and the backspace command (BSP) as in the case of FIG. 38. Hence, the MTU 30 must separately perform the piecemeal mechanical operation for each data block, thereby requiring a significant long processing time.
A description will now be given of an illustrative job to continuously issue the read back commands. For example, when a database is updated, modified data is recorded onto a backup magnetic tape as transaction log data. The transaction log data recorded on the magnetic tape is not used in a normal operating state.
However, if any error occurs in the database, a system recovers the database by using the transaction log data. The system continuously issues the read back commands to read the transaction log data in a backward direction from the latest transaction log data (that is, the last data block on the magnetic tape), and compares the transaction log data with data on the database for recovery.
In this case, since the ROR processing is performed for each of the data blocks as shown in FIG. 39, a long time is required to read the data in the backward direction from the magnetic tape. Therefore, a failure occurring in the database results in vast amounts of time required for the recovery operation, which may become a critical problem for system users.
As described above, it is generally impossible to directly expand in the data expanding circuit 13 the EDRC compressed data read in the backward direction. In order to realize the expansion of the compressed data in hardware, it is necessary to mount a circuit to reverse the backward data between the data expanding circuit 13 and the data buffer 17, resulting in a more costly and heavier hardware. Hence, it has been desired to enhance performance of the ROR processing by firmware.